package com.irishud.hud;

import android.app.Activity;
import android.view.Gravity;
import android.view.WindowManager;

import com.irishud.hudnavi.BuildConfig;

/**TODO load data from data file
 * Created by Administrator on 2016/7/26.
 */
public class HudProductModel {
    public static int SCREEN_SHIFT_TO_Y = 125;
    public static int SCREEN_SHIFT_TO_X = 0;
    public final static String productType = "s1";

    public  static void adaptProductUI(Activity act)
    {
        if(BuildConfig.PRODUCT.equals("s1"))
        {
            initWindowParamterForS1(act);
        }
    }

    private static void initWindowParamterForS1(Activity activity) {
        WindowManager.LayoutParams wmParams = activity.getWindow().getAttributes();
        // 调整悬浮窗显示的停靠位置
        wmParams.gravity = Gravity.TOP | Gravity.START;
        // 以屏幕左上角为原点，设置x、y初始值，相对于gravity
        wmParams.x = HudProductModel.SCREEN_SHIFT_TO_X;
        wmParams.y = HudProductModel.SCREEN_SHIFT_TO_Y;
        // 设置悬浮窗口长宽数据
        wmParams.width = 800;
        wmParams.height = 240;
        activity.getWindow().setAttributes(wmParams);
    }

    public static void readScreenData()
    {
        // TODO: read screen.txt
    }
}
